<?php
/**
 * Created by PhpStorm.
 * User: KHACHUNG
 * Date: 4/24/14
 * Time: 7:22 AM
 */
class UploadComponent extends Component{
    function upload($file,$url='../../app/webroot/img/upload/'){
        if(isset($file['name'])){
            $filename=$file['name'];
            $tmp=$file['tmp_name'];
            move_uploaded_file($tmp,$url.$filename);
            return $filename;
        }
        else
            return false;
    }
}